package com.jjb.www.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.app.AppAdapter;
import com.jjb.www.http.api.DryRrunApi;

/**
 *    author : Android CRG
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2018/11/05
 *    desc   : 可进行拷贝的副本
 */
public final class DryRunAdapter extends AppAdapter<DryRrunApi.Bean> {

    public DryRunAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private ShapeTextView mTvEndTime;
        private ShapeTextView mTvScore;
        private ShapeTextView mTvExamTypeName;



        private ViewHolder() {
            super(R.layout.item_dry_run);
            mTvEndTime = findViewById(R.id.tv_end_time);
            mTvScore = findViewById(R.id.tv_score);
            mTvExamTypeName = findViewById(R.id.tv_exam_type_name);
        }

        @Override
        public void onBindView(int position) {
            DryRrunApi.Bean bean = getItem(position);
            mTvEndTime.setText(bean.getEnd_time());
            mTvScore.setText(bean.getScore()+"分");
            mTvExamTypeName.setText(bean.getExam_type_name());
        }
    }
}